package dt. member;

import com.opensymphony.xwork2.ActionSupport;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;

public class zipCheckAction extends ActionSupport {

	public static Reader reader;  // ���� ��Ʈ���� ���� reader
	public static SqlMapClient sqlMapper; // SqlMapClient API�� ����ϱ� ���� sqlMapper ��ü

	
	private String dong;
	private List<zipcodeVO> zipcodeList = new ArrayList<zipcodeVO>();
	
	//����
	public zipCheckAction() throws IOException {
		reader = Resources.getResourceAsReader("sqlMapConfig.xml"); //sqlMapConfig.xml ������ ���������� �����´�.
		sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader); //sqlMapConfig.xml ������ ����� sqlMapper ��ü ��
		reader.close();
	}
	
	// �����ȣ�˻� �׼�
	public String execute() throws Exception {
		//�� �̸��� �ִ� �ٸ� �÷� ������ �����´�.
		zipcodeList = sqlMapper.queryForList("zipcheck", "%"+getDong()+"%");
			
		return SUCCESS;
	}

	public static Reader getReader() {
		return reader;
	}

	public static void setReader(Reader reader) {
		zipCheckAction.reader = reader;
	}

	public static SqlMapClient getSqlMapper() {
		return sqlMapper;
	}

	public static void setSqlMapper(SqlMapClient sqlMapper) {
		zipCheckAction.sqlMapper = sqlMapper;
	}

	public String getDong() {
		return dong;
	}

	public void setDong(String dong) {
		this.dong = dong;
	}

	public List<zipcodeVO> getZipcodeList() {
		return zipcodeList;
	}

	public void setZipcodeList(List<zipcodeVO> zipcodeList) {
		this.zipcodeList = zipcodeList;
	}
	
	
}
